
<?php //var_dump($view_data); ?>

<style type="text/css">
.reward_percent{width: 30px;}
</style>

<div class="current_location">
    <ul>
        <li><a>当前位置：</a></li>
        <li><a>用户管理</a></li>
    </ul>
</div>

<div class="search_bar">
    <form id="search_form" onsubmit="return search_list();" action="<?php echo $this->get_url(array('page_num' => 1)); ?>" method="get">

        <ul class="search_field">
            <li>
                <label>编号：</label>
                <input type="text" name="id" value="<?php echo $view_data['id']; ?>">
            </li>
            <li>
                <label>名称：</label>
                <input type="text" name="keywords" value="<?php echo $view_data['keywords']; ?>">
            </li>
        </ul>

        <div class="search_bar_sub_bar">
            <!-- <input type="hidden" name="page_num" value="1"/> -->
            <input class="input_submit" type="submit" value="搜索" />
        </div>
    </form>
</div>

<!--
<div class="action_bar">
    <ul>
        <li><a>操作：</a></li>
        <li>
            <a href="<?php //echo $view_data['add_form_url']; ?>">新增</a>
        </li>
    </ul>
</div>
-->


<table class="list_table">
    <thead>
    <tr>
        <th class="list_table_no">序号</th>
        <th class="list_table_id">编号（ID）</th>
        <th>手机</th>
        <th>上次登录时间</th>
        <th width="80">上次登录IP</th>
        <th width="80">登录次数</th>
        <th>注册时间</th>
        <!-- <th width="30">状态</th> -->
        <th class="list_table_action">操作</th>
    </tr>
    </thead>
    <tbody>

    <?php $no = 1; ?>
    <?php foreach ($view_data['member_list'] as $member): ?>
        <tr>
            <td class="list_table_no"><?php echo $no; ?></td>
            <td class="list_table_id"><?php echo $member['id']; ?></td>
            <td><?php echo $member['mobile']; ?></td>
            <td><?php echo $member['last_login_time_date_time']; ?></td>
            <td><?php echo $member['last_login_ip']; ?></td>
            <td><?php echo $member['login_count']; ?></td>
            <td><?php echo $member['create_time_date_time']; ?></td>
            <!-- <td><?php //echo $member['status_desc']; ?></td> -->

            <td class="list_table_action">
                <a onclick="reset_password('<?php echo $member['id']; ?>')">重置密码</a><!-- | -->
            </td>
        </tr>

        <?php $no++; ?>
    <?php endforeach ?>

    </tbody>
</table>

<?php //echo $view_data['page_lib_output']; ?>

<script type="text/javascript">

function search_list(){
    var id = $("#search_form input[name='id']").val();
    var keywords = $("#search_form input[name='keywords']").val();

    var url_params_json = <?php echo $this->get_url_params_json(array('page_num' => 1), true); ?>;
    url_params_json['page_num'] = 1;
    url_params_json['id'] = id;
    url_params_json['keywords'] = keywords;
    var url = wwy_get_url(url_params_json);

    window.top.location.replace(url);

    return false;
}


function reset_password(id){
    var post_data = 'id=' + id;

    $.ajax({
        type: 'POST',
        url: "<?php echo $this->get_url(array('route' => 'pc_background_member_reset_password'), true); ?>",
        data: post_data,
        dataType: 'json',
        success: function(rdata){
            if(rdata.status <= 0){
                alert(rdata.message);
            }else{
                alert(rdata.message);
            }

            return false;
        }
    });
}
</script>
